package org.lzy.shop.viewmodel.repository.lmpl

import org.lzy.shop.network.KtorApiService
import org.lzy.shop.response.ListDTO
import org.lzy.shop.viewmodel.repository.BaseRepository
import org.lzy.shop.viewmodel.repository.CommentRepository

class CommentRepositoryImpl: BaseRepository(), CommentRepository {

    override suspend fun getGoodsComment(page: Int?, goodsId: String?): MutableList<ListDTO>? {
        return safeApiCall {
            val response = KtorApiService.getGoodsComment(
                page = page ?: 1,
                size = 10,
                goodsId = goodsId
            )
            handleResponse(response).list
        }
    }
}